define(function(require, exports, module) {
    var ALL = require("../../common/all"),
        CONFIG = ALL.CONFIG,
        METHOD = ALL.METHOD,
        Dialog = ALL.Dialog,
        Init = ALL.Init;

    var _vm = Init.initVue({
        data : {
            list : [],
            month : curDate(),
            fee_total : '',
            cur : 1,
            all : 0,
            total : 0,
            search : false,
        },
        methods: {
            reSearch : function() {
                this.search = true;
                this.getData(1);
            },
            reset : function() {
                this.search = false;
                this.month = curDate();
            },
            getData : function(n) {

                var obj = {
                    page : n,
                    num : 10,
                    time: _vm.month
                };

                METHOD.loading.show();
                METHOD.ajax("team/agent/fee/list",obj).done(function(json){
                    METHOD.loading.hide();
                    _vm.list = json.data.list;
                    _vm.total = json.page.total;
                    _vm.fee_total = json.data.total;
                    _vm.all = json.page.pages;
                }).fail(function(){
                    METHOD.loading.hide();
                });
            }
        }
    });

    // 获取当前月份
    function curDate() {
        var now = new Date(),
            year = now.getFullYear(),       // 年
            month = now.getMonth() + 1,
            date;

        date = year + "-";

        if (month < 10) { date += "0"; }
        date += month;

        return date;
    }

    _vm.getData(1);

});

